﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HR.Appointments.Service.ValueObjects
{
    /// <summary>
    /// Holds the the duration slots for the system.
    /// </summary>
    public class TimeDuration
    {
        #region Private Memebers
        private const int DEFAULT_DURATION = 30;
        private int _id;
        private int _durationValue;
        #endregion

        #region Constructors
        private TimeDuration(int id, int durationValue)
        {
            _id = id;
            _durationValue = durationValue;
        }
        #endregion

        #region Properties
        /// <summary>
        /// The duration value of a timeslot in minutes
        /// </summary>
        public int DurationValue
        {
            get 
            {
                if (_durationValue == 0)
                {
                    return Default;
                }
                else
                {
                    return _durationValue;
                }
            }
        }

        /// <summary>
        /// A default value for the timeslot
        /// </summary>
        public int Default
        {
            get
            {
                return DEFAULT_DURATION;
            }
        }
        #endregion

        #region Static Methods
        /// <summary>
        /// Creates a new time slot
        /// </summary>
        /// <param name="durationValue">A duration value in minute that is modable with an hour (e.g. 30, 15, 10, 60)</param>
        /// <returns>A new timeslot object</returns>
        public static TimeDuration Create(int durationValue)
        {
            return new TimeDuration(0, durationValue);
        }
        #endregion
    }
}
